package online.hxstart.code.concurrent.chapter06;

import java.util.concurrent.TimeUnit;

/**
 * @author huxing
 * @date 19-5-31 星期五 下午5:20
 * @describe
 */
public class ThreadGroupPriority {

  public static void main(String[] args) {
    //

    ThreadGroup group = new ThreadGroup("group1");
    Thread thread = new Thread(group, () -> {
      while (true) {
        try {
          TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }
    }, "thread");

    thread.setDaemon(true);
    thread.start();

    System.out.println("group.getMaxPriority()=" + group.getMaxPriority());
    System.out.println("thread.getMaxPriority()=" + thread.getPriority());

    group.setMaxPriority(3);

    System.out.println("group.getMaxPriority()=" + group.getMaxPriority());
    System.out.println("thread.getMaxPriority()=" + thread.getPriority());
  }

}
